package com.cn.xiaonuo.tcrfinance.tcrshops.controller;

import com.cn.xiaonuo.common.entity.BusinessMessage;
import com.cn.xiaonuo.tcrfinance.tcrshops.param.*;
import com.cn.xiaonuo.tcrfinance.tcrshops.service.ThirdStorageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * @BelongsProject: slb-reports-java
 * @Author: likui
 * @CreateTime: 2023-01-31  09:21
 * @Description: TODO
 */
@RestController
public class ThirdStorageController {

    @Autowired
    private ThirdStorageService thirdStorageService;

    @ApiOperation(value = "乡村振兴--第三方仓储列表", notes = "乡村振兴--第三方仓储列表")
    @PostMapping("/api/thirdStorage/pageThirdStorage")
    public BusinessMessage pageThirdStorage(@RequestBody PageThirdStorageParam param){
        return thirdStorageService.pageThirdStorage(param);
    }

    @ApiOperation(value = "乡村振兴--添加第三方仓储", notes = "乡村振兴--添加第三方仓储")
    @PostMapping("/api/thirdStorage/addThirdStorage")
    public BusinessMessage addThirdStorage(@RequestBody AddThirdStorageParam param){
        return thirdStorageService.addThirdStorage(param);
    }

    @ApiOperation(value = "乡村振兴--第三方仓储编辑", notes = "乡村振兴--第三方仓储编辑")
    @PostMapping("/api/thirdStorage/editThirdStorage")
    public BusinessMessage editThirdStorage(@RequestBody EditThirdStorageParam param){
        return thirdStorageService.editThirdStorage(param);
    }

    @ApiOperation(value = "乡村振兴--出入仓记录", notes = "乡村振兴--出入仓记录")
    @PostMapping("/api/thirdStorage/storageRecordPage")
    public BusinessMessage storageRecordPage(@RequestBody StorageRecordPageParam param){
        return thirdStorageService.storageRecordPage(param);
    }

    @ApiOperation(value = "乡村振兴--出入仓凭证更新", notes = "乡村振兴--出入仓凭证更新")
    @PostMapping("/api/thirdStorage/updateVoucher")
    public BusinessMessage updateVoucher(@RequestBody UpdateVoucherParam param){
        return thirdStorageService.updateVoucher(param);
    }

    @ApiOperation(value = "搜了宝订单管理--出仓记录导出", notes = "搜了宝订单管理--出仓记录导出")
    @GetMapping(value = "/api/thirdStorage/outgoingRecordExcel")
    public void outgoingRecordExcel(HttpServletResponse response, StorageRecordPageParam param) {
        thirdStorageService.outgoingRecordExcel(response,param);
    }

    @ApiOperation(value = "搜了宝订单管理--入仓记录导出", notes = "搜了宝订单管理--出仓记录导出")
    @GetMapping(value = "/api/thirdStorage/warehousingRecordExcel")
    public void warehousingRecordExcel(HttpServletResponse response, StorageRecordPageParam param) {
        thirdStorageService.warehousingRecordExcel(response,param);
    }

}
